<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>父类选择器</title>
  <style>
    .parent{
      display: flex;
      padding: 20px;
      background: rgba(102, 192, 57,.5);
      margin-bottom: 20px;
      gap: 20px;
    }
    .parent .son{
      display: inline-block;
      background: #4fa4ee;
      width: 100px;
      height: 100px;
    }
    .parent .bad-son{
      background: #c9173b;
    }

    .parent .son:empty{
      background: #c9173b;
    }
  </style>
</head>
<body>
  <div class="parent">
    <p>parent1</p>
    <div class="son">son1</div>
    <div class="son">son2</div>
    <div class="son">son3</div>
  </div>

  <div class="parent">
    <p>parent2</p>
    <div class="son">son1</div>
    <div class="son">son2</div>
    <div class="son bad-son">son3 坏男孩</div>
  </div>

  <div class="parent">
    <p>parent3</p>
    <div class="son">son1</div>
    <div class="son">son2</div>
    <div class="son">son3</div>
  </div>

  <div class="parent">
    <p>parent4</p>
    <div class="son"></div>
    <div class="son">son2</div>
    <div class="son">son3</div>
  </div>
</body>
</html>